package lumis.portal.sendmail;

import java.util.Date;

import lumis.portal.stability.StableMinor;

/**
 * Stores information about the sending situation of a mail.
 * @since 4.0.4
 * @version $Revision: 13082 $ $Date: 2011-05-27 16:03:12 -0300 (Fri, 27 May 2011) $
 */
@StableMinor(version = "6.0", sinceVersion = "4.0")
public interface IMailSendStatus
{
	/** 
	 * Status code that indicates the sending is pending.
	 * @see #getStatus() 
	 * @since 4.0.4
	 */ 
	public static final int STATUS_SEND_PENDING = 1;
	
	/** 
	 * Status code that indicates the sending is in progress.
	 * If this status code stays for much time may indicate the sending
	 * process was interrupted, and it is not possible to know if it
	 * was sent or not. 
	 * @see #getStatus() 
	 * @since 4.0.4
	 */ 
	public static final int STATUS_SENDING = 2;
	
	/** 
	 * Status code that indicates the sending was completed successfully.
	 * @see #getStatus() 
	 * @since 4.0.4
	 */ 
	public static final int STATUS_SENT_OK = 4;

	/** 
	 * Status code that indicates the sending was tried but was unsucessful.
	 * @see #getStatus()
	 * @see #getErrorMessage() 
	 * @since 4.0.4
	 */ 
	public static final int STATUS_SENT_ERROR = 8;
	
	/**
	 * Returns the datetime of the last try to send the mail. 
	 * @return the datetime of the last try to send the mail.
	 * @since 4.0.4
	 */
	public Date getSentDateTime();
	
	/**
	 * Sets the datetime of the last try to send the mail. 
	 * @param sentDate the datetime value to set.
	 * @since 4.0.4
	 */
	public void setSentDateTime(Date sentDate);

	/**
	 * Returns the status of the sending of the mail. 
	 * @return The status of the sending of the mail.
	 * @see #STATUS_SEND_PENDING
	 * @see #STATUS_SENDING
	 * @see #STATUS_SENT_OK
	 * @see #STATUS_SENT_ERROR
	 * @since 4.0.4
	 */
	public int getStatus();
	
	/**
	 * Sets the sending status of the mail.
	 * @param status the status value to set.
	 * @see #STATUS_SEND_PENDING
	 * @see #STATUS_SENDING
	 * @see #STATUS_SENT_OK
	 * @see #STATUS_SENT_ERROR
	 * @since 4.0.4
	 */
	public void setStatus(int status);
	
	/**
	 * Returns the error message of the last try to send the mail.
	 * @return the error message of the last try to send the mail.
	 * @since 4.0.4
	 */
	public String getErrorMessage();
	
	/**
	 * Sets the error message of the last try to send the mail. 
	 * @param msg the error message to set.
	 * @since 4.0.4
	 */
	public void setErrorMessage(String msg);
}